<template>
  <div class="m-t">
    <el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="100px">
      <el-form-item label="账号：">
        <span v-if="!isEdit">{{ formInline.user10 }}</span>
        <el-input v-else v-model="formInline.user10" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="姓名：">
        <span v-if="!isEdit">{{ formInline.user }}</span>
        <el-input v-else v-model="formInline.user" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="性别：">
        <span v-if="!isEdit">{{ formInline.user2 }}</span>
        <el-select v-else v-model="formInline.user2" placeholder="请选择">
          <el-option label="男" value="男"></el-option>
          <el-option label="女" value="女"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="出生年月：">
        <span v-if="!isEdit">{{ formInline.user3 }}</span>
        <el-input v-else v-model="formInline.user3" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="手机号：">
        <span v-if="!isEdit">{{ formInline.user4 }}</span>
        <el-input v-else v-model="formInline.user4" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="工作单位：">
        <span v-if="!isEdit">{{ formInline.user5 }}</span>
        <el-input v-else v-model="formInline.user5" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="所属部门：">
        <span v-if="!isEdit">{{ formInline.user6 }}</span>
        <el-input v-else v-model="formInline.user6" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="学历：">
        <span v-if="!isEdit">{{ formInline.user7 }}</span>
        <el-input v-else v-model="formInline.user7" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="专业：">
        <span v-if="!isEdit">{{ formInline.user8 }}</span>
        <el-input v-else v-model="formInline.user8" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="毕业院校">
        <span v-if="!isEdit">{{ formInline.user9 }}</span>
        <el-input v-else v-model="formInline.user9" placeholder=""></el-input>
      </el-form-item>
    </el-form>
    <div>
      <span class="p-r">
        <el-button class="m-b" type="primary" @click="close()">账号口令重置</el-button>
        <el-button class="m-b" type="primary" @click="close()">账号口令修改</el-button>
      </span>
      <el-button v-if="!isEdit" class="m-b" type="primary" @click="editClick()">基本信息修改</el-button>
      <span v-else>
        <el-button class="m-b" type="primary" @click="close()">保存</el-button>
        <el-button class="m-b m-r" @click="close()">取消</el-button>
      </span>
      <el-button class="m-b" type="danger" @click="close()">账号注销</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isEdit: false,
      formInline: {
        user: '管理员',
        user10: 'admin',
        user2: '男',
        user3: '1987年10月',
        user4: '15612345678',
        user5: '国防大学',
        user6: '教研部',
        user7: '博士研究生',
        user8: '化学',
        user9: '国防大学'
      }
    }
  },
  methods: {
    editClick() {
      this.isEdit = true
    },
    close() {
      this.isEdit = false
    }
  }
}
</script>

<style lang="less" scoped>
  ::v-deep(.el-form-item) {
    margin-bottom: 10px;
  }
</style>